package org.aldar.bquest.constants;

/**
 * User: Daria
 * Date: 6/9/13 11:36 PM
 */
public enum LandscapeType {

    TOWN(true, true),
    DARK_FOREST,
    DEAD_FOREST,
    OAKS,
    GRAIN,
    ROCK,
    HILLS,
    BLOSSOM_HILLS,
    APPLE_TREES,
    VILLAGE,
    VILLAGE_GREY,
    PUMPKIN,
    FORESTVILLAGE(true, true),
    CASTLE(true, true),
    CEMETERY,
    JACKOLANTERN,
    TOWN_BLUE(true, true),
    RUINS,
    TOWNADD,
    TOWNADD2,
    WATER(false),
    CRYSTAL_BASE(false, false),
    CRYSTAL(CRYSTAL_BASE, false, false),
    BIGCRYSTAL(CRYSTAL_BASE, false, false),
    CRYSTAL_ABILITY(CRYSTAL_BASE, false, false),
    BUSHES,
    LAVA,
    IDOL,
    TOWN_LAVA(true, true),
    DEAD_FOREST_LAVA,
    DARK_ROCKS,
    CRATER,
    WATER_GREEN(false),
    BUSHES_SWAMP,
    VILLAGE_SWAMP(true, true),
    DEAD_FOREST_SWAMP,
    ROCKS_SWAMP,
    LILLY,
    CANE, IDOL_MAGICLAND, MUSHROOMS, ROCKS_MAGICLAND,
    TOWN_MAGICLAND(true, true),
    DEAD_FOREST_MAGICLAND, BLOSSOM_HILLS_MAGICLAND;

    private boolean allowsConcerts = false;
    private LandscapeType baseType;
    private boolean produceCrystal = true;

    LandscapeType() {
    }

    LandscapeType(boolean produceCrystal) {
        this.produceCrystal = produceCrystal;
    }

    LandscapeType(boolean produceCrystal, boolean allowsConcerts) {
        this.produceCrystal = produceCrystal;
        this.allowsConcerts = allowsConcerts;
    }

    LandscapeType(LandscapeType baseType, boolean produceCrystal, boolean allowsConcerts) {
        this.produceCrystal = produceCrystal;
        this.allowsConcerts = allowsConcerts;
        this.baseType = baseType;
    }

    public static boolean allowMatch(LandscapeType style1, LandscapeType style2) {
        if (style1 == style2) {
            return true;
        }
        if (style1.baseType != null && style2.baseType != null && style1.baseType == style2.baseType) {
            return true;
        }
        return false;
    }

    public boolean isProduceCrystal() {
        return produceCrystal;
    }

    public LandscapeType getBaseType() {
        return baseType;
    }

    public boolean allowsConcerts() {
        return allowsConcerts;
    }
}
